#include <iostream>
using namespace std;

// 加号运算符重载

class MyInteger
{
friend ostream &operator<<(ostream &cout, MyInteger myint);
public:

    MyInteger()
    {
        m_Num = 0;
    }

    // 重载前置 ++ 运算符 返回的是引用
    MyInteger& operator++()
    {
        m_Num++;
        return *this;
    }

    // 重载后置 ++ 运算符
    // int 是一个占位参数用于区分前置和后置,返回的是值
    MyInteger operator++(int)
    {
        // 先记录当时的结果
        MyInteger temp = *this;
        // 后递增
        m_Num++;
        // 最后记录结果返回
        return temp;
    }

private:
    int m_Num;
};

// 2.只能全局函数重载左移运算符  
ostream &operator<<(ostream &cout, MyInteger myint)
{
    cout << myint.m_Num;
    return cout;
} 
 
 

void test01() 
{
    MyInteger myint;
    cout << ++(++myint) << endl;
    cout << myint << endl;
} 
 
void test02() 
{
    MyInteger myint;
    cout << myint++ << endl;
    cout << myint << endl;
} 

int main()
{
    // test01();
    test02();
    // int a = 0;
    // cout << ++a << endl;
    cout << "hello" << endl;
    return 0;
}